package com.qst.excep;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class Test02 {
    public static void main(String[] args) {
       try{
           test03();
       }catch (NullPointerException e){
           System.out.println("空指针异常");
       }

    }

    public static void test03() {
        int num_01=5;
        if(num_01==5){
//           NullPointerExceptio空指针异常
            throw new NullPointerException();
        }


    }


//异常处理 主动抛出异常，由调用者进行处理，若一直向上抛，最后由JVM进行处理
    public static void test01() throws FileNotFoundException {
        FileInputStream file=new FileInputStream("");
    }
    public static void test02() throws FileNotFoundException {
        test01();
    }
}
